<?php

namespace App\Services\Ocean\Report;

use App\Common\Helpers\Functions;
use App\Common\Tools\CustomException;
use App\Models\Ocean\Report\OceanMaterialReportModel;
use Illuminate\Support\Facades\DB;

class OceanMaterialReportService extends OceanReportV2Service
{
    /**
     * constructor.
     * @param string $appId
     */
    public function __construct($appId = ''){
        parent::__construct($appId);

        $this->modelClass = OceanMaterialReportModel::class;
    }

    /**
     * @param $accountIds
     * @param $accessToken
     * @param $filtering
     * @param $page
     * @param $pageSize
     * @param array $param
     * @return mixed|void
     * sdk批量获取列表
     */
    public function sdkMultiGetList($accountIds, $accessToken, $filtering, $page, $pageSize, $param = []){
        return $this->sdk->multiGetCustomV2ReportList($accountIds, $accessToken, $filtering, $page, $pageSize, $param);
    }

    /**
     * @param $option
     * @return array|bool
     * 设置过滤条件
     */
    protected function setFiltering($option){
        $this->filtering = [
            [
                'field' => 'image_mode',
                'type' => 1,
                'operator' => 7,
                'values' => ["2", "3", "5", "15", "16"],
            ],
        ];
        return true;
    }

    /**
     * @return array|string
     * 获取分组
     */
    protected function getGroupBy(){
        return 'STAT_GROUP_BY_APP_PROMOTION_ID';
    }

    /**
     * @return string
     * 获取时间维度
     */
    public function getTimeGranularity(){
        return 'STAT_TIME_GRANULARITY_DAILY';
    }

    /**
     * @return array
     * 获取报表维度
     */
    public function getReprotDimensions(){
        return ["stat_time_day", "cdp_promotion_id", "material_id"];
    }
}
